package com.tianji.learning.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tianji.common.domain.dto.PageDTO;
import com.tianji.common.domain.query.PageQuery;
import com.tianji.learning.domain.po.LearningLesson;
import com.tianji.learning.domain.vo.LearningLessonVO;
import com.tianji.learning.domain.vo.LearningPlanPageVO;
import com.tianji.learning.domain.vo.LearningStatusVO;

import java.util.List;

/**
 * @author User
 * @description 针对表【learning_lesson(学生课表)】的数据库操作Service
 * @createDate 2024-12-07 11:29:36
 */
public interface ILearningLessonService extends IService<LearningLesson> {
	/**
	 * 添加课程到课表
	 *
	 * @param userId
	 * @param courseIds
	 */
	void addUserLessons(Long userId, List<Long> courseIds);

	/**
	 * 分页查询我的课表
	 *
	 * @param pageQuery
	 * @return
	 */
	PageDTO<LearningLessonVO> queryMyLessons(PageQuery pageQuery);

	/**
	 * 查询当前正在学习的课程
	 *
	 * @return
	 */
	LearningLessonVO queryMyCurrentLesson();

	/**
	 * 删除已经失效的课程
	 *
	 * @param courseId
	 */
	void removeByCId(Long courseId);

	/**
	 * 校验当前用户是否可以学习当前课程
	 * @param courseId 课程id
	 * @return lessonId，如果是报名了则返回lessonId，否则返回空
	 */
	Long isLessonValid(Long courseId);

	/**
	 * 检查课程状态
	 * @param courseId
	 * @return
	 */
	LearningStatusVO queryLearningStatus(Long courseId);

	/**
	 * 统计课程学习人数
	 * @param courseId 课程id
	 * @return 学习人数
	 */
	Integer countLearningLessonByCourse(Long courseId);

	/**
	 * 查询用户的课表信息
	 * @param userId
	 * @param courseId
	 * @return
	 */
	LearningLesson queryByUserAndCourseId(Long userId, Long courseId);

	/**
	 * 创建学习计划
	 * @param courseId
	 * @param freq
	 */
	void createLearningPlan(Long courseId, Integer freq);

	/**
	 * 查询我的学习计划
	 * @param query
	 * @return
	 */
	LearningPlanPageVO queryMyPlans(PageQuery query);
}